<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="Content-Language" content="zh-CN"><link href="stylesheet.css" media="all" rel="stylesheet" type="text/css">
<title>RELEASE SAVEPOINT</title>
<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?d286c55b63a3c54a1e43d10d4c203e75"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script>
</head><body class="REFENTRY">
<div>
<table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><th colspan="5" align="center" valign="bottom">PostgreSQL 8.2.3 中文文档</th></tr>
<tr><td width="10%" align="left" valign="top"><a href="sql-reindex.html" accesskey="P">后退</a></td><td width="10%" align="left" valign="top"><a href="sql-reindex.html">快退</a></td><td width="60%" align="center" valign="bottom"></td><td width="10%" align="right" valign="top"><a href="sql-reset.html">快进</a></td><td width="10%" align="right" valign="top"><a href="sql-reset.html" accesskey="N">前进</a></td></tr>
</table>
<hr align="LEFT" width="100%"></div>
<h1><a name="SQL-RELEASE-SAVEPOINT"></a>RELEASE SAVEPOINT</h1>
<div class="REFNAMEDIV"><a name="AEN53125"></a><h2>名称</h2>RELEASE SAVEPOINT&nbsp;--&nbsp;删除一个先前定义的保存点</div>
<a name="AEN53128"></a><a name="AEN53130"></a>
<div class="REFSYNOPSISDIV"><a name="AEN53133"></a><h2>语法</h2>
<pre class="SYNOPSIS">RELEASE [ SAVEPOINT ] <tt class="REPLACEABLE"><i>savepoint_name</i></tt></pre>
</div>
<div class="REFSECT1"><a name="AEN53136"></a><h2>描述</h2>
<p><tt class="COMMAND">RELEASE SAVEPOINT</tt> 删除一个当前事务先前定义的保存点。</p>
<p>把一个保存点删除就令其无法作为回滚点使用，除此之外它没有其它用户可见的行为。它并不能撤销在保存点建立起来之后执行的命令的影响。要撤销那些命令可以使用 <a href="sql-rollback-to.html"><i>ROLLBACK TO SAVEPOINT</i></a> 。在不再需要的时候删除一个保存点可以令系统在事务结束之前提前回收一些资源。</p>
<p><tt class="COMMAND">RELEASE SAVEPOINT</tt> 也删除所有在指定的保存点建立之后的所有保存点。</p>
</div>
<div class="REFSECT1"><a name="AEN53144"></a><h2>参数</h2>
<div class="VARIABLELIST">
<dl>
<dt><tt class="REPLACEABLE"><i>savepoint_name</i></tt></dt>
<dd><p>要删除的保存点的名字</p></dd>
</dl>
</div>
</div>
<div class="REFSECT1"><a name="AEN53152"></a><h2>注意</h2>
<p>声明一个以前没有定义的保存点名字将导致错误。</p>
<p>如果事务在回滚状态，则不能释放保存点。</p>
<p>如果多个保存点拥有同样的名字，只有最近定义的那个才被释放。</p>
</div>
<div class="REFSECT1"><a name="AEN53157"></a><h2>例子</h2>
<p>建立并稍后删除一个保存点：</p>
<pre class="PROGRAMLISTING">BEGIN;
    INSERT INTO table1 VALUES (3);
    SAVEPOINT my_savepoint;
    INSERT INTO table1 VALUES (4);
    RELEASE SAVEPOINT my_savepoint;
COMMIT;</pre>
<p>上面的事务将同时插入 3 和 4 。</p>
</div>
<div class="REFSECT1"><a name="AEN53161"></a><h2>兼容性</h2>
<p>这条命令遵循 SQL 标准。标准规定关键字 <tt class="LITERAL">SAVEPOINT</tt> 是必须的。但 PostgreSQL 允许省略它。</p>
</div>
<div class="REFSECT1"><a name="AEN53167"></a><h2>又见</h2><a href="sql-begin.html"><i>BEGIN</i></a>, <a href="sql-commit.html"><i>COMMIT</i></a>, <a href="sql-rollback.html"><i>ROLLBACK</i></a>, <a href="sql-rollback-to.html"><i>ROLLBACK TO SAVEPOINT</i></a>, <a href="sql-savepoint.html"><i>SAVEPOINT</i></a></div>
<div>
<hr align="LEFT" width="100%">
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td width="33%" align="left" valign="top"><a href="sql-reindex.html" accesskey="P">后退</a></td><td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">首页</a></td><td width="33%" align="right" valign="top"><a href="sql-reset.html" accesskey="N">前进</a></td></tr>
<tr><td width="33%" align="left" valign="top">REINDEX</td><td width="34%" align="center" valign="top"><a href="sql-commands.html" accesskey="U">上一级</a></td><td width="33%" align="right" valign="top">RESET</td></tr>
</table>
</div>
</body></html>